package com.example.guestbook.service.impl;

import com.example.guestbook.mapper.BooklistMapper;
import com.example.guestbook.pojo.Booklist;
import com.example.guestbook.service.IBooklistService;
import lombok.Setter;
import org.springframework.transaction.annotation.Transactional;

@Setter
public class BooklistServiceImpl implements IBooklistService
{
    private BooklistMapper booklistMapper;

    @Override
    @Transactional
    public boolean add(Booklist booklist)
    {
        System.out.println("add");
        int result = booklistMapper.insert(booklist);
        System.out.println("add ok");
        return result>0;
    }
}

//    Creating a new SqlSession
//        SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4001f832] was not registered for synchronization because synchronization is not active
//        Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4001f832]